package com.dankegongyu.component.jsbridge.listener;

import com.dankegongyu.component.jsbridge.jsbridge.CallBackFunction;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 */
public abstract class DKWebJsPlugin implements Serializable {

    private List<String> mActions = new ArrayList<>();

    public final List<String> getActions() {
        onRegister();
        return mActions;
    }

    protected abstract void onRegister();

    protected void register(String name) {
        if (!mActions.contains(name)) {
            mActions.add(name);
        }
    }

    public abstract boolean excute(String action, String data, CallBackFunction function);
}
